]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Scripting.createTestWindow(): take params
authorOwen W. Taylor <otaylor@fishsoup.net>
Tue, 20 May 2014 01:00:01 +0000 (21:00 -0400)
committerOwen W. Taylor <otaylor@fishsoup.net>
Sun, 29 Jun 2014 22:27:54 +0000 (18:27 -0400)
Take a parameter object rather than a long parameter list containing
multiple booleans.

https://bugzilla.gnome.org/show_bug.cgi?id=732349

js/perf/core.js
js/ui/scripting.js

index 86f2c849e92400e9bdb8ff704b7d2b80d5598f96..b9f5494d5c7b6ae58aa17ba4181e8968621c5663 100644 (file)
@@ -87,7 +87,10 @@ function run() {
             yield Scripting.destroyTestWindows();
 
             for (let k = 0; k < config.count; k++)
-                yield Scripting.createTestWindow(config.width, config.height, config.alpha, config.maximized);
+                yield Scripting.createTestWindow({ width: config.width,
+                                                   height: config.height,
+                                                   alpha: config.alpha,
+                                                   maximized: config.maximized });
 
             yield Scripting.waitTestWindows();
             yield Scripting.sleep(1000);
index f952ed07b12174bbeac02f88633926aadc874442..4e7453a0d7793ab2383b2bffc33ac6e2b3fb312b 100644 (file)
@@ -7,6 +7,7 @@ const Meta = imports.gi.Meta;
 const Shell = imports.gi.Shell;
 
 const Main = imports.ui.main;
+const Params = imports.misc.params;
 
 // This module provides functionality for driving the shell user interface
 // in an automated fashion. The primary current use case for this is
@@ -99,9 +100,11 @@ function _getPerfHelper() {
 
 /**
  * createTestWindow:
- * @width: width of window, in pixels
- * @height: height of window, in pixels
- * @alpha: whether the window should be alpha transparent
+ * @params: options for window creation.
+ *   width - width of window, in pixels (default 640)
+ *   height - height of window, in pixels (default 480)
+ *   alpha - whether the window should have an alpha channel (default false)
+ *   maximized - whether the window should be created maximized (default false)
  * @maximized: whethe the window should be created maximized
  *
  * Creates a window using gnome-shell-perf-helper for testing purposes.
@@ -110,11 +113,17 @@ function _getPerfHelper() {
  * because of the normal X asynchronous mapping process, to actually wait
  * until the window has been mapped and exposed, use waitTestWindows().
  */
-function createTestWindow(width, height, alpha, maximized) {
+function createTestWindow(width, height, params) {
+    params = Params.parse(params, { width: 640,
+                                    height: 480,
+                                    alpha: false,
+                                    maximized: false });
+
     let cb;
     let perfHelper = _getPerfHelper();
 
-    perfHelper.CreateWindowRemote(width, height, alpha, maximized,
+    perfHelper.CreateWindowRemote(params.width, params.height,
+                                  params.alpha, params.maximized,
                                   function(result, excp) {
                                       if (cb)
                                           cb();